A whole number written as text with at least count digits, filled with zeros in front: string_digits(7, 3) is "007" and string_digits(5, 2) is "05". Made for clocks and scores: string_join(string_digits(minutes, 2), string_join(":", string_digits(seconds, 2))) is "01:07".
string_digits(n, count) -> string| Name | Type |
|---|---|
n | int |
count | int |
string
A whole number written as text with at least count digits, filled with zeros in front. string_digits(7, 3) is "007" and string_digits(5, 2) is "05". Made for clocks and scores.
var minutes = 1;
var seconds = 7;
var clock = string_join(string_digits(minutes, 2), string_join(":", string_digits(seconds, 2)));clock is "01:07".
n has to be a whole number. string_digits(x, 3) with a real x is refused when the project is checked: round it first with int_floor or int_round.count shows all of them: string_digits(1234, 2) is "1234". It is never cut.count: string_digits(-7, 3) is "-007".count below 1 counts as 1.string writes a number with no padding.One pass over the digits.
n must be a whole number (an int): string_digits(x, 3) with a real x is refused when the project is checked, so round it first with int_floor or int_round. A number with more digits than count shows all of them, never cut: string_digits(1234, 2) is "1234". A negative number gets a minus in front that is not counted: string_digits(-7, 3) is "-007". A count below 1 reads as 1. If the text would not fit in a string it is cut off at the end. string_from_number writes a number with no padding.